// 当前温度湿度值
let currentTemperature = 23.5;
let currentHumidity = 65;
let autoUpdate = false;
let updateInterval;

// 温度仪表盘配置
export const temperatureOption = {
	series: [
		{
			type: 'gauge',
			center: ['50%', '70%'],
			radius: '90%',
			min: -10,
			max: 50,
			startAngle: 180,
			endAngle: 0,
			progress: {
				show: true,
				width: 20,
			},
			axisLine: {
				lineStyle: {
					width: 20,
					color: [
						[0.3, '#67e0e3'],
						[0.7, '#37a2da'],
						[1, '#fd666d'],
					],
				},
			},
			axisTick: {
				distance: -30,
				length: 8,
				lineStyle: {
					color: '#fff',
					width: 2,
				},
			},
			axisLabel: {
				distance: -40,
				color: '#fff',
				fontSize: 9,
			},
			pointer: {
				icon: 'path://M12.8,0.7l12,40.1H0.7L12.8,0.7z',
				length: '12%',
				width: 20,
				offsetCenter: [0, '-60%'],
				itemStyle: {
					color: 'auto',
				},
			},
			detail: {
				valueAnimation: true,
				formatter: '{value}°C',
				color: 'auto',
				fontSize: 30,
				offsetCenter: [0, '0%'],
			},
			title: {
				offsetCenter: [0, '30%'],
				fontSize: 16,
				color: '#fff',
			},
			data: [
				{
					value: currentTemperature,
					name: '当前温度',
				},
			],
		},
	],
};

// 湿度仪表盘配置
export const humidityOption = {
	series: [
		{
			type: 'gauge',
			center: ['50%', '70%'],
			radius: '90%',
			min: 0,
			max: 100,
			startAngle: 180,
			endAngle: 0,
			progress: {
				show: true,
				width: 20,
			},
			axisLine: {
				lineStyle: {
					width: 20,
					color: [
						[0.3, '#91cc75'],
						[0.7, '#37a2da'],
						[1, '#9a60b4'],
					],
				},
			},
			axisTick: {
				distance: -30,
				length: 8,
				lineStyle: {
					color: '#fff',
					width: 2,
				},
			},
			axisLabel: {
				distance: -40,
				color: '#fff',
				fontSize: 9,
			},
			pointer: {
				icon: 'path://M12.8,0.7l12,40.1H0.7L12.8,0.7z',
				length: '12%',
				width: 20,
				offsetCenter: [0, '-60%'],
				itemStyle: {
					color: 'auto',
				},
			},
			detail: {
				valueAnimation: true,
				formatter: '{value}%',
				color: 'auto',
				fontSize: 30,
				offsetCenter: [0, '0%'],
			},
			title: {
				offsetCenter: [0, '30%'],
				fontSize: 16,
				color: '#fff',
			},
			data: [
				{
					value: currentHumidity,
					name: '当前湿度',
				},
			],
		},
	],
};
